import { request } from '@utils/http'
import {
  IhospitalListParams,
  IhospitalListRes,
  IprovinceList,
  IDitList,
  Status,
  IShowDetail,
  IdepList,
  IscheduleRuleRes,
  IscheduleRule
} from './model/hospitalListType'
// 获取医院列表表格数据的函数
export function reqGetHospitalList({
  page,
  limit,
  hosname,
  hoscode,
  hostype,
  provinceCode,
  cityCode,
  districtCode,
  status,
}: IhospitalListParams) {
  return request.get<any, IhospitalListRes>(
    `/admin/hosp/hospital/${page}/${limit}`,
    {
      params: {
        page,
        limit,
        hosname,
        hoscode,
        hostype,
        provinceCode,
        cityCode,
        districtCode,
        status,
      },
    }
  )
}

//获取省数据接口
export const reqGetPorvince =(dictCode='province') =>
    request.get<any ,IprovinceList >(`/admin/cmn/dict/findByDictCode/${dictCode}`)

    //获取市、区、医院类型接口
export const reqGetDit =(parentId='10000') =>
    request.get<any ,IDitList>(`/admin/cmn/dict/findByParentId/${parentId}`)

    //上下线
 export const reqGetLine =(id:number,status:Status) =>
    request.get<any ,null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)

    //查看医院详情
    export const reqHosDetail =(id:string) =>
    request.get<any ,IShowDetail>(`/admin/hosp/hospital/show/${id}`)

    //科室管理
    export const reqDep =(hoscode:string) =>
    request.get<any ,IdepList>(`/admin/hosp/department/${hoscode}`)

      //排版规则
    export const reqRegular =(page:number,limit:number,hoscode:string,depcode:string) =>
    request.get<any,IscheduleRuleRes >(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)

    //排班管理

    export const reqSchedule =(hoscode:string,depcode:string,workDate:string) =>
    request.get<any,IscheduleRule >(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
